<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>增加采购订单</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="../../../elementUI/index.css">
  <link rel="stylesheet" href="../../../css/index.css">
  <style>
    .el-input .el-input__inner,
    .el-input.is-disabled .el-input__inner,
    .el-textarea .el-textarea__inner,
    .el-textarea.is-disabled .el-textarea__inner {
      color: #000;
    }
  </style>
</head>

<body>
  <div id="app" class="minWidth">
    <el-form :model="form" ref="contract" :rules="rules" inline-message="true" style="width: 100%">
      <div class="table_titel">
        <div class="titel">增加采购订单</div>
      </div>
      <el-descriptions :column="3" border size="small">
        <el-descriptions-item label="供应商编号">
          <el-form-item prop="Supplier_SerialNumber">
            <el-select v-model.trim="form.Supplier_SerialNumber" placeholder="请选择供应商" filterable style="width: 100%">
              <el-option v-for="(item,index) in supplier_info" :key="index" :label="item.Supplier_Name"
                :value="item.Supplier_SerialNumber"></el-option>
            </el-select>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="采购日期">
          <el-form-item prop="Purchase_Date">
            <el-date-picker v-model.trim="form.Purchase_Date" type="datetime" placeholder="选择日期时间"
              value-format="yyyy-MM-dd HH:mm:ss" default-time="12:00:00">
            </el-date-picker>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="订单金额">
          <el-form-item prop="Purchase_Amount">
            <el-input :disabled="true" v-model.trim="form.Purchase_Amount" placeholder="请输入订单金额"></el-input>
          </el-form-item>
        </el-descriptions-item>
      </el-descriptions>
      <div class="table_titel">
        <div class="titel">采购明细</div>
        <div class="operation">
          <el-button type="primary" size="small" @click="add_purchase_order_detail">新增</el-button>
          <el-button type="danger" size="small" @click="remove_purchase_order_detail">删除</el-button>
        </div>
      </div>
      <div style="margin-bottom: 100px;">
        <el-descriptions style="margin-bottom: 20px;" :column="3" border size="small"
          v-for="(item,index) in form.Children.purchase_order_detail" :key="index">
          <el-descriptions-item label="品牌编号">
            <el-form-item prop="Brand_SerialNumber">
              <el-select v-model.trim="item.Brand_SerialNumber" @change="getArticle($event,index)" placeholder="请选择品牌"
                filterable style="width: 100%">
                <el-option v-for="(item,index) in brand" :key="index" :label="item.Brand_Name"
                  :value="item.Brand_SerialNumber"></el-option>
              </el-select>
            </el-form-item>
          </el-descriptions-item>
          <el-descriptions-item label="商品编号">
            <el-form-item prop="Article_SerialNumber">
              <el-select :disabled="!item.Brand_SerialNumber" @change="getUnitPrice($event,index)"
                v-model.trim="item.Article_SerialNumber" placeholder="请选择商品" filterable style="width: 100%">
                <el-option v-for="(item,index) in item.article" :key="index" :label="item.Article_Name"
                  :value="item.Article_SerialNumber"></el-option>
              </el-select>
            </el-form-item>
          </el-descriptions-item>
          <el-descriptions-item label="商品吊牌价">
            <el-form-item prop="Article_UnitPrice">
              <el-input :disabled="true" v-model.trim="item.Article_UnitPrice" placeholder="请输入商品吊牌价"></el-input>
            </el-form-item>
          </el-descriptions-item>
          <el-descriptions-item label="成交单价">
            <el-form-item>
              <el-input v-model.trim="item.Purchase_UnitPrice" @change="count(index)" placeholder="请输入成交单价"></el-input>
            </el-form-item>
          </el-descriptions-item>
          <el-descriptions-item label="数量">
            <el-form-item>
              <el-input v-model.trim="item.Quantity" @change="count(index)" placeholder="请输入数量"></el-input>
            </el-form-item>
          </el-descriptions-item>
          <el-descriptions-item label="成交金额">
            <el-form-item>
              <el-input :disabled="true" v-model.trim="item.Amount" placeholder="请输入成交金额"></el-input>
            </el-form-item>
          </el-descriptions-item>
          <el-descriptions-item label="仓库">
            <el-form-item>
              <el-select v-model="item.Store_SerialNumber" placeholder="请选择仓库">
                <el-option v-for="item in Wares" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-descriptions-item>
        </el-descriptions>
      </div>


      <el-form-item class="form-operation">
        <el-button @click="window.history.back()">返回</el-button>
        <el-button type="primary" :loading="loading" @click="submitForm('contract')">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
  <script type="text/javascript" src="../../../js/jquery-3.6.0.min.js"></script>
  <script type="text/javascript" src="../../../js/jquery.cookie.js"></script>
  <script type="text/javascript" src="../../../js/vue.min.js"></script>
  <script type="text/javascript" src="../../../elementUI/index.js"></script>
  <script type="text/javascript" src="../../../js/utils.js"></script>
  <script type="text/javascript" src="../../../js/ID_Validity.js"></script>
  <script type="text/javascript" src="./js/Add.js"></script>
</body>

</html>